<template>
  <dt-modal-info ref="modalRef" title="查看文章" :width="400" class="import_article_modal">
    <!-- <iframe :src="url" v-if="url" style="width: 100%; height: 700px" frameborder="0" :key="url" id="iframe" /> -->
    <div style="width: 100%; height: 700px">
      <dt-iframe :url="url" v-if="url"></dt-iframe>
    </div>
  </dt-modal-info>
</template>
<script setup>
  import { ref, nextTick } from 'vue'
  import dt from '@dt/dt'
  import server from '@/config/server'

  const modalRef = ref()
  const url = ref()
  function show(id) {
    modalRef.value.show()
    init(id)
  }

  function init(id) {
    url.value = dt.env.h5Url + '/#/pages/editor/index?preview=1&id=' + id
    // setTimeout(() => {
    //   const iframe = document.getElementById('iframe')
    //   const iframeWin = iframe.contentWindow || iframe
    //   iframeWin.postMessage(JSON.stringify(server.auth.info), '*')
    // }, 700)
  }

  defineExpose({
    show
  })
</script>

<style lang="scss" scope></style>
